// 引入http-proxy-middleware模块(需要下载包)
const {
    createProxyMiddleware
} = require('http-proxy-middleware');


module.exports = function (app) {
    app.use(
        '/api1',
        createProxyMiddleware({
            //目标地址
            target: 'http://127.0.0.1:8080',
            //伪装身份为目标地址
            changeOrigin: true,
            //去掉前缀
            pathRewrite: {
                '^/api1': ''
            }
        })
    )
}